from django.db import models


class ChargingPoint(models.Model):
    current_choices = (('AC', '交流电'), ('DC', '直流电'))
    ownership_choices = (('exclusive', '专享'), ('public', '公共'))

    point_number = models.AutoField(primary_key=True)
    address = models.CharField(max_length=30)
    total_number = models.IntegerField(default=1)
    available_number = models.IntegerField(default=1)
    current_type = models.CharField(max_length=10, choices=current_choices)
    ownership_type = models.CharField(max_length=10, choices=ownership_choices)


class AreaInfo(models.Model):
    title = models.CharField(max_length=255)
    parea = models.ForeignKey('self',null=True,blank=True,on_delete=models.CASCADE)
    # parea 对应的表里的id 是parea_id


class RoutePlan(models.Model):
    power_number = models.AutoField(primary_key=True)
    address = models.CharField(max_length=30)
    duration = models.DecimalField(max_digits=10, decimal_places=2)
    distance = models.DecimalField(max_digits=10, decimal_places=2)
    latitude = models.DecimalField(max_digits=10, decimal_places=6)
    longitude = models.DecimalField(max_digits=10, decimal_places=6)
    total_number = models.IntegerField(default=1)
    available_number = models.IntegerField(default=1)
    current_type = models.CharField(max_length=10)
    ownership_type = models.CharField(max_length=10)
